
const data = {
    username: 'None',
    listener: []
}

const user = {
    get: function() {
        return data.username;
    },
    set: function(name) {
        data.username = name;
        data.listener.forEach((f) => {
            f && f(data.username)
        })
    },
    addListener: (f) => {
        data.listener.push(f);
    }
};

export default user